﻿using MySql.Data.MySqlClient;
using SGV.Datos.Interfases;
using SGV.Entidad;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using DapperExtensions;

namespace SGV.Datos.Repositories
{
    public class ProvinciaRepository :IProvinciaRepository
    {
        private IDbConnection _Db;

        public ProvinciaRepository()
        {
            //constructor
        }

        public IList<Provincia> FindAll()
        {
            using (_Db = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQL"].ToString()))
            {
                const string query = @"SELECT id, nombre FROM provincia";
                return _Db.Query<Provincia>(query).ToList();
            }
        }

        public IQueryable<Provincia> Find(Expression<Func<Provincia, bool>> predicate)
        {
            throw new NotImplementedException();
        }

        public Provincia FindById(int id)
        {
            throw new NotImplementedException();
        }

        public int add(Provincia newEntity)
        {
            throw new NotImplementedException();
        }

        public bool remove(int id)
        {
            throw new NotImplementedException();
        }

        public int Modify(Provincia entity)
        {
            throw new NotImplementedException();
        }
    }
}
